package com.ra.util;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Index;

import com.espirit.eap.sa.LoginUser;
import com.googlecode.cswish.annotation.cm;

@Entity
@cm("短信日志")
public class SmsLog {

	@cm("注册")
	public final static Integer TYPE_REGISTER = 0;
	@cm("重置密码")
	public final static Integer TYPE_RESET_PASSWORD = 1;
	@cm("费用通知")
	public final static Integer TYPE_FEE_NOTIFY = 2;
	@cm("短信提醒")
	public final static Integer TYPE_REMINDER_LETTER = 3;
	@cm("申请绑定微信号") 
	public final static Integer TYPE_BIND_WEIXIN = 4;
	@cm("申请改变账号身份为房东管家")
	public final static Integer TYPE_SWITCH_ASSIST = 5;
	@cm("房东注册成功提示")
	public final static Integer TYPE_REGISTER_LANDLORD_SUCCESS = 6;
	@cm("房东收款通知")
	public final static Integer TYPE_SEND_TRANSFER = 7;
	@cm("品牌审核通过")
	public final static Integer TYPE_BRAND_AUDITED = 8;
	@cm("未知")
	public final static Integer TYPE_REMINDER_UNKNOWN = 10;
	
	private Integer id;
	
	
	private String mobile;
	
	// 消息类型
	private Integer type;
	
	// 内容
	private String content;
	
	// 发送日期
	private Date sendDate;
	
	// 提交请求的IP(可为空)
	private String ip;
	
	// 附加标志
	private String extFlag;
	
	// 发送用户 (可为空)
	// 如果系统发送, 刚为超级管理员
	private LoginUser loginUser;
	
	// 是否为免费发送
	private Boolean free;
	
	// 是否收到回馈: 适用于某些需要用户确认收到消息的场景
	private Boolean feedback;
		
	// 反馈时间: 适用于某些需要用户确认收到消息的场景
	private Date feedbackDate;
	
	// 短信发送商的返回码
	private String returnStatus;

	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Index(name="idx_ra_smslog_mobile")
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	
	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Column(length=1024)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Index(name="idx_ra_smslog_senddate")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getSendDate() {
		return sendDate;
	}

	public void setSendDate(Date sendDate) {
		this.sendDate = sendDate;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getExtFlag() {
		return extFlag;
	}

	public void setExtFlag(String extFlag) {
		this.extFlag = extFlag;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public LoginUser getLoginUser() {
		return loginUser;
	}

	public void setLoginUser(LoginUser loginUser) {
		this.loginUser = loginUser;
	}

	public Boolean getFree() {
		return free;
	}

	public void setFree(Boolean free) {
		this.free = free;
	}
	
	public Boolean getFeedback() {
		return feedback;
	}

	public void setFeedback(Boolean feedback) {
		this.feedback = feedback;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getFeedbackDate() {
		return feedbackDate;
	}

	public void setFeedbackDate(Date feedbackDate) {
		this.feedbackDate = feedbackDate;
	}

	public String getReturnStatus() {
		return returnStatus;
	}

	public void setReturnStatus(String returnStatus) {
		this.returnStatus = returnStatus;
	}
}
